Skip to content

feat: Allow for request headers to be passed in#446

Merged
camdecoster merged 7 commits intomasterfrom
cam/445/add-headers
Apr 29, 2026
Merged

feat: Allow for request headers to be passed in#446
camdecoster merged 7 commits intomasterfrom
cam/445/add-headers

Conversation

@camdecoster
Copy link
Copy Markdown
Contributor

@camdecoster camdecoster commented Apr 22, 2026

Description

Allow for request headers to be passed from Kaleido to Choreographer.

Closes #445.

Changes

  • Add headers keyword argument for Kaleido class
  • Add tests

Testing

  • Check CI

Comment thread src/py/kaleido/_kaleido_tab/_tab.py Outdated
# requires a couple extra lines
self.js_logger.reset()

await self._apply_headers()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a potential for a race condition here, where some requests might get sent before the headers are applied? Should _apply_headers() be called earlier in this function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed, maybe? Moving this call earlier shouldn't hurt anything, so I'll do that.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camdecoster Are you still OK with moving this call earlier?

Also, should the headers be applied to the initial call to Page.navigate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it before the call to Page.navigate but forgot to push changes. It will show up soon.

Comment thread src/py/kaleido/_kaleido_tab/_tab.py
ayjayt
ayjayt previously approved these changes Apr 29, 2026
Copy link
Copy Markdown
Collaborator

@ayjayt ayjayt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread src/py/kaleido/_kaleido_tab/_tab.py Outdated
async def _apply_headers(self):
"""Apply extra HTTP headers to the tab if configured."""
if self._headers:
_logger.debug2(f"Setting extra HTTP headers on {self.tab}")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

so here i would do like

_logger.debug(f"Setting extra HTTP headers on {self.tab}")
_logger.debug2(f"Extra headers are: {self._headers}")

When debugging is turned up to level 2, the amount of output is ENORMOUS, so if its a normal debugging situation and it's not a huge dump, I'd debug on level 1, regular _logger.debug.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update it.

@camdecoster camdecoster merged commit 9e001ca into master Apr 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Allow request headers to be passed in to Choregrapher

4 participants